import javax.swing.*;

import java.util.ArrayList;
import java.awt.*;
import java.awt.event.*;


public class DisplayPanel extends JPanel {

	JButton btnCard1;
	JButton btnCard2;
	JButton btnCard3;
	JButton btnCard4;
	JButton btnCard5;
	JButton btnCard6;
	JButton btnCard7;
	JButton btnCard8;
	JButton btnLogicCharge;
	JButton btnEthicsCharge;
	JButton btnPassionCharge;
	JButton btnDeceptionCharge;
	JButton btn2Card1;
	JButton btn2Card2;
	JButton btn2Card3;
	JButton btn2Card4;
	JButton btn2Card5;
	JButton btn2Card6;
	JButton btn2Card7;
	JButton btn2Card8;
	JButton btnLogicCharge2;
	JButton btnEthicsCharge2;
	JButton btnPassionCharge2;
	JButton btnDeceptionCharge2;
	JButton btnGo;
	JLabel lblEffect1;
	JLabel lblWhoseTurn;
	JLabel lblEffect2;
	int source1;
	int source2;
	
	int whoseturn;
	Game g;
	JPanel dp;
	
	/**
	 * Create the panel.
	 */
	public DisplayPanel(Game game) {
		setBackground(Color.LIGHT_GRAY);
		setLayout(new BorderLayout());
		setSize(800,600);
		g = game;
		dp = this;
		ButtonListener butt = new ButtonListener();
		
		JPanel ChargePanel = new JPanel();
		add(ChargePanel, BorderLayout.NORTH);
		ChargePanel.setPreferredSize(new Dimension(800,50));
		ChargePanel.setLayout(new GridLayout(0, 4, 0, 0));
		
		btnLogicCharge = new JButton("LC: 0");
		btnLogicCharge.addActionListener(butt);
		btnLogicCharge.setMaximumSize(new Dimension(200,50));
		ChargePanel.add(btnLogicCharge);
		btnLogicCharge.setBackground(new Color(224,224,255));
		
		btnEthicsCharge = new JButton("EC: 0");
		btnEthicsCharge.addActionListener(butt);
		btnEthicsCharge.setMaximumSize(new Dimension(200,50));
		btnEthicsCharge.setBackground(new Color(255,255,128));
		ChargePanel.add(btnEthicsCharge);
		
		btnPassionCharge = new JButton("PC: 0");
		btnPassionCharge.addActionListener(butt);
		btnPassionCharge.setMaximumSize(new Dimension(200,50));
		btnPassionCharge.setBackground(new Color(255,128,128));
		ChargePanel.add(btnPassionCharge);
		
		btnDeceptionCharge = new JButton("DC: 0");
		btnDeceptionCharge.addActionListener(butt);
		btnDeceptionCharge.setMaximumSize(new Dimension(200,50));
		btnDeceptionCharge.setBackground(new Color(128,128,128));
		ChargePanel.add(btnDeceptionCharge);
		
		
		
		JPanel ButtonPanel = new JPanel();
        add(ButtonPanel, BorderLayout.WEST);
        ButtonPanel.setPreferredSize(new Dimension(200,600));
        ButtonPanel.setLayout(new GridLayout(9, 1, 0, 0));
        
        lblWhoseTurn = new JLabel("Player One, it's your move", SwingConstants.CENTER);
        lblWhoseTurn.setToolTipText("Srsly, pick something");
        lblWhoseTurn.setBackground(Color.WHITE);
        ButtonPanel.add(lblWhoseTurn);
        
        btnCard1 = new JButton("Card 1");
        btnCard1.addActionListener(butt);
        btnCard1.setPreferredSize(new Dimension(100,20));
        ButtonPanel.add(btnCard1);
        
        btnCard2 = new JButton("Card2");
        btnCard2.addActionListener(butt);
        ButtonPanel.add(btnCard2);
        
        btnCard3 = new JButton("Card3");
        btnCard3.addActionListener(butt);
        ButtonPanel.add(btnCard3);
        
        btnCard4 = new JButton("Card4");
        btnCard4.addActionListener(butt);
        ButtonPanel.add(btnCard4);
        
        btnCard5 = new JButton("Card5");
        btnCard5.addActionListener(butt);
        ButtonPanel.add(btnCard5);
        
        btnCard6 = new JButton("Card6");
        btnCard6.addActionListener(butt);
        ButtonPanel.add(btnCard6);
        
        btnCard7 = new JButton("Card7");
        btnCard7.addActionListener(butt);
        ButtonPanel.add(btnCard7);
        
        btnCard8 = new JButton("Card8");
        btnCard8.addActionListener(butt);
        ButtonPanel.add(btnCard8);

		
		
		/**
		JPanel ButtonPanel2 = new JPanel();
		add(ButtonPanel2, BorderLayout.EAST);
		
		ButtonPanel2.setLayout(new GridLayout(8, 1, 0, 0));
		
		btn2Card1 = new JButton("Card 1");
		btn2Card1.addActionListener(butt);
		ButtonPanel2.add(btn2Card1);
		
		btn2Card2 = new JButton("Card2");
		btn2Card2.addActionListener(butt);
		ButtonPanel2.add(btn2Card2);
		
		btn2Card3 = new JButton("Card3");
		btn2Card3.addActionListener(butt);
		ButtonPanel2.add(btn2Card3);
		
		btn2Card4 = new JButton("Card4");
		btn2Card4.addActionListener(butt);
		ButtonPanel2.add(btn2Card4);
		
		btn2Card5 = new JButton("Card5");
		btn2Card5.addActionListener(butt);
		ButtonPanel2.add(btn2Card5);
		
		btn2Card6 = new JButton("Card6");
		btn2Card6.addActionListener(butt);
		ButtonPanel2.add(btn2Card6);
		
		btn2Card7 = new JButton("Card7");
		btn2Card7.addActionListener(butt);
		ButtonPanel2.add(btn2Card7);
		
		btn2Card8 = new JButton("Card8");
		btn2Card8.addActionListener(butt);
		ButtonPanel2.add(btn2Card8);
		
		*/
		
		DrawPanel dp = new DrawPanel(g);
		add(dp, BorderLayout.CENTER);
		
		
		
		
		
		/*
		Component horizontalGlue_4 = Box.createHorizontalGlue();
		ChargePanel.add(horizontalGlue_4);
		
		
		btnLogicCharge2 = new JButton("LC: 0");
		btnLogicCharge2.addActionListener(butt);
		btnLogicCharge2.setBackground(new Color(128,128,255));
		ChargePanel.add(btnLogicCharge2);
		
		Component rigidArea_5 = Box.createRigidArea(new Dimension(20, 20));
		ChargePanel.add(rigidArea_5);
		
		btnEthicsCharge2 = new JButton("EC: 0");
		btnEthicsCharge2.addActionListener(butt);
		btnEthicsCharge2.setBackground(new Color(255,255,128));
		ChargePanel.add(btnEthicsCharge2);
		
		Component rigidArea_6 = Box.createRigidArea(new Dimension(20, 20));
		ChargePanel.add(rigidArea_6);
		
		btnPassionCharge2 = new JButton("PC: 0");
		btnPassionCharge2.addActionListener(butt);
		btnPassionCharge2.setBackground(new Color(255,128,128));
		ChargePanel.add(btnPassionCharge2);
		
		Component rigidArea_7 = Box.createRigidArea(new Dimension(20, 20));
		ChargePanel.add(rigidArea_7);
		
		btnDeceptionCharge2 = new JButton("DC: 0");
		btnDeceptionCharge2.addActionListener(butt);
		btnDeceptionCharge2.setBackground(new Color(128,128,128));
		ChargePanel.add(btnDeceptionCharge2);
		*/
		
		
		
		JPanel startPanel = new JPanel();
		add(startPanel, BorderLayout.SOUTH);
		
		btnGo = new JButton("Go!");
		btnGo.addActionListener(butt);
		startPanel.setLayout(new BoxLayout(startPanel, BoxLayout.X_AXIS));
		
		lblEffect1 = new JLabel("Pick Something to Play!");
		startPanel.add(lblEffect1);
		
		Component horizontalGlue = Box.createHorizontalGlue();
		startPanel.add(horizontalGlue);
		startPanel.add(btnGo);
		/*
		horizontalGlue = Box.createHorizontalGlue();
		startPanel.add(horizontalGlue);
		
		lblEffect2 = new JLabel("Pick Something to Play!");
		startPanel.add(lblEffect2);
		*/
		whoseturn = 1;
		updateButtons();

	}
	
	
	
	private class ButtonListener implements ActionListener
	{
		
		public void actionPerformed(ActionEvent e)
		{
			if (whoseturn == 1)
			{
				ArrayList<Card> hand1 = g.getPlayerOne().getHand();
				
				
				if (e.getSource() == btnCard1 && btnCard1.getText() != "")
				{
					if ((int)(hand1.get(0).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 1;
						lblEffect1.setText("Player 1 will play: " + hand1.get(0));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(0).getName());
					}
					
				}
				else if (e.getSource() == btnCard2 && btnCard2.getText() != "")
				{
					if ((int)(hand1.get(1).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 2;
						lblEffect1.setText("Player 1 will play: " + hand1.get(1));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(1).getName());
					}
				}
				else if (e.getSource() == btnCard3 && btnCard3.getText() != "")
				{
					if ((int)(hand1.get(2).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 3;
						lblEffect1.setText("Player 1 will play: " + hand1.get(2));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(2).getName());
					}
				}
				else if (e.getSource() == btnCard4 && btnCard4.getText() != "")
				{
					if ((int)(hand1.get(3).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 4;
						lblEffect1.setText("Player 1 will play: " + hand1.get(3));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(3).getName());
					}
				}
				else if (e.getSource() == btnCard5 && btnCard5.getText() != "")
				{
					if ((int)(hand1.get(4).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 5;
						lblEffect1.setText("Player 1 will play: " + hand1.get(4));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(4).getName());
					}
				}
				else if (e.getSource() == btnCard6 && btnCard6.getText() != "")
				{
					if ((int)(hand1.get(5).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 6;
						lblEffect1.setText("Player 1 will play: " + hand1.get(5));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(5).getName());
					}
				}
				else if (e.getSource() == btnCard7 && btnCard7.getText() != "")
				{
					if ((int)(hand1.get(6).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 7;
						lblEffect1.setText("Player 1 will play: " + hand1.get(6));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(6).getName());
					}
				}
				else if (e.getSource() == btnCard8 && btnCard8.getText() != "")
				{
					if ((int)(hand1.get(7).getCost() * g.getPlayerOne().getEgoCostRate()) < g.getPlayerOne().getCurrentEgo())
					{
						source1 = 8;
						lblEffect1.setText("Player 1 will play: " + hand1.get(7));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand1.get(7).getName());
					}
				}
				else if (e.getSource() == btnLogicCharge && g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.LOGIC) > 1)
				{
					source1 = 9;
					lblEffect1.setText("Player 1 will build a Logic Block");
				}
				else if (e.getSource() == btnEthicsCharge && g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.ETHICS) > 1)
				{
					source1 = 10;
					lblEffect1.setText("Player 1 will build an Ethics Block");
				}
				else if (e.getSource() == btnPassionCharge && g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.PASSION) > 1)
				{
					source1 = 11;
					lblEffect1.setText("Player 1 will build a Passion Block");
				}
				else if (e.getSource() == btnDeceptionCharge && g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.DECEPTION) > 1)
				{
					source1 = 12;
					lblEffect1.setText("Player 1 will build a Deception Block");
				}
				else if (e.getSource() == btnGo)
				{
					if (source1 != 0)
					{
						lblEffect1.setText("");
						blackButtons();
						JOptionPane.showMessageDialog(dp,"Player Two's Turn");
						whoseturn = 2;
						updateButtons();
						repaint();
					}
				}
			}
			else
			{
				ArrayList<Card> hand2 = g.getPlayerTwo().getHand();
				
				if (e.getSource() == btnCard1 && btnCard1.getText() != "")
				{
					if ((int)(hand2.get(0).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 1;
						lblEffect1.setText("Player 2 will play: " + hand2.get(0));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(0).getName());
					}
					
				}
				else if (e.getSource() == btnCard2 && btnCard2.getText() != "")
				{
					if ((int)(hand2.get(1).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 2;
						lblEffect1.setText("Player 2 will play: " + hand2.get(1));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(1).getName());
					}
				}
				else if (e.getSource() == btnCard3 && btnCard3.getText() != "")
				{
					if ((int)(hand2.get(2).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 3;
						lblEffect1.setText("Player 2 will play: " + hand2.get(2));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(2).getName());
					}
				}
				else if (e.getSource() == btnCard4 && btnCard4.getText() != "")
				{
					if ((int)(hand2.get(3).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 4;
						lblEffect1.setText("Player 2 will play: " + hand2.get(3));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(3).getName());
					}
				}
				else if (e.getSource() == btnCard5 && btnCard5.getText() != "")
				{
					if ((int)(hand2.get(4).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 5;
						lblEffect1.setText("Player 2 will play: " + hand2.get(4));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(4).getName());
					}
				}
				else if (e.getSource() == btnCard6 && btnCard6.getText() != "")
				{
					if ((int)(hand2.get(5).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 6;
						lblEffect1.setText("Player 2 will play: " + hand2.get(5));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(5).getName());
					}
				}
				else if (e.getSource() == btnCard7 && btnCard7.getText() != "")
				{
					if ((int)(hand2.get(6).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 7;
						lblEffect1.setText("Player 2 will play: " + hand2.get(6));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(6).getName());
					}
				}
				else if (e.getSource() == btnCard8 && btnCard8.getText() != "")
				{
					if ((int)(hand2.get(7).getCost() * g.getPlayerTwo().getEgoCostRate()) < g.getPlayerTwo().getCurrentEgo())
					{
						source2 = 8;
						lblEffect1.setText("Player 2 will play: " + hand2.get(7));
					}
					else
					{
						lblEffect1.setText("You do not have enough ego to play " + hand2.get(7).getName());
					}
				}
				else if (e.getSource() == btnLogicCharge && g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.LOGIC) > 1)
				{
					source2 = 9;
					lblEffect1.setText("Player 2 will build a Logic Block");
				}
				else if (e.getSource() == btnEthicsCharge && g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.ETHICS) > 1)
				{
					source2 = 10;
					lblEffect1.setText("Player 2 will build an Ethics Block");
				}
				else if (e.getSource() == btnPassionCharge && g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.PASSION) > 1)
				{
					source2 = 11;
					lblEffect1.setText("Player 2 will build a Passion Block");
				}
				else if (e.getSource() == btnDeceptionCharge && g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.DECEPTION) > 1)
				{
					source2 = 12;
					lblEffect1.setText("Player 2 will build a Deception Block");
				}
				else if (e.getSource() == btnGo)
				{
					if (source2 != 0)
					{
						blackButtons();
						Card playcard1, playcard2;
						ArrayList<EffectActive> list1 = new ArrayList<EffectActive>();
						ArrayList<EffectActive> list2 = new ArrayList<EffectActive>();
						if (source1 < 9)
						{
							playcard1 = g.getPlayerOne().playCard(source1-1);
						}
						else
						{
							switch (source1)
							{
								case 9: 
									list1.add(new EffectActive("BuildLogicBlockCommand",8,g.getPlayerOne()));
									playcard1 = new Card("A Logic Block","","",0,2,"", list1, new ArrayList<EffectPassive>());
									break;
								case 10: 
									list1.add(new EffectActive("BuildEthicsBlockCommand",14,g.getPlayerOne()));
									playcard1 = new Card("An Ethics Block","","",0,-2,"", list1, new ArrayList<EffectPassive>());
									break;
								case 11: 
									list1.add(new EffectActive("BuildPassionBlockCommand",20,g.getPlayerOne()));
									playcard1 = new Card("A Passion Block","","",0,-2,"", list1, new ArrayList<EffectPassive>());
									break;
								case 12: 
									list1.add(new EffectActive("BuildDeceptionBlockCommand",20,g.getPlayerOne()));
									playcard1 = new Card("A Deception Block","","",0,2,"", list1, new ArrayList<EffectPassive>());
									break;
								default:
									playcard1 = g.nullCard;
									break;
							}
						}
						repaint();
						
						if (source2 < 9)
						{
							playcard2 = g.getPlayerTwo().playCard(source2-1);
						}
						else
						{
							switch (source2)
							{
								case 9: 
									list2.add(new EffectActive("BuildLogicBlockCommand",8,g.getPlayerTwo()));
									playcard2 = new Card("A Logic Block","","",0,0,"", list2, new ArrayList<EffectPassive>());
									break;
								case 10: 
									list2.add(new EffectActive("BuildEthicsBlockCommand",14,g.getPlayerTwo()));
									playcard2 = new Card("An Ethics Block","","",0,0,"", list2, new ArrayList<EffectPassive>());
									break;
								case 11: 
									list2.add(new EffectActive("BuildPassionBlockCommand",20,g.getPlayerTwo()));
									playcard2 = new Card("A Passion Block","","",0,0,"", list2, new ArrayList<EffectPassive>());
									break;
								case 12: 
									list2.add(new EffectActive("BuildDeceptionBlockCommand",20,g.getPlayerTwo()));
									playcard2 = new Card("A Deception Block","","",0,0,"", list2, new ArrayList<EffectPassive>());
									break;
								default:
									playcard2 = g.nullCard;
									break;
							}
						}
						lblEffect1.setText("");
						g.runTurn(playcard1, playcard2);
						source1 = 0;
						source2 = 0;
						
						g.updateBuffs();
						JOptionPane.showMessageDialog(dp,"Player One's Turn");
						whoseturn = 1;
						updateButtons();
						repaint();
					}
				}
			}
			
			
			
			//Run it all
			
		}
	}
	
	
	
	
	
	void updateButtons()
	{
		if (whoseturn == 1)
		{
			ArrayList<Card> hand1 = g.getPlayerOne().getHand();
			
			if (hand1.size() > 0 && hand1.get(0) != null)
			{
				btnCard1.setText(hand1.get(0).getName());
				btnCard1.setToolTipText("Cost: " + (int)(hand1.get(0).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(0).getActiveDescription());
				btnCard1.setBackground(hand1.get(0).getColor());
			}
			else
			{
				btnCard1.setText("");
				btnCard1.setToolTipText("");
				btnCard1.setBackground(Color.white);
			}
			
			
			if (hand1.size() > 1 && hand1.get(1) != null)
			{
				btnCard2.setText(hand1.get(1).getName());
				btnCard2.setToolTipText("Cost: " + (int)(hand1.get(1).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(1).getActiveDescription());
				btnCard2.setBackground(hand1.get(1).getColor());
			}
			else
			{
				btnCard2.setText("");
				btnCard2.setToolTipText("");
				btnCard2.setBackground(Color.white);
			}
			
			
			if (hand1.size() > 2 && hand1.get(2) != null)
			{
				btnCard3.setText(hand1.get(2).getName());
				btnCard3.setToolTipText("Cost: " + (int)(hand1.get(2).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(2).getActiveDescription());
				btnCard3.setBackground(hand1.get(2).getColor());
			}
			else
			{
				btnCard3.setText("");
				btnCard3.setToolTipText("");
				btnCard3.setBackground(Color.white);
			}
			
			
			if (hand1.size() > 3 && hand1.get(3) != null)
			{
				btnCard4.setText(hand1.get(3).getName());
				btnCard4.setToolTipText("Cost: " + (int)(hand1.get(3).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(3).getActiveDescription());
				btnCard4.setBackground(hand1.get(3).getColor());
			}
			else
			{
				btnCard4.setText("");
				btnCard4.setToolTipText("");
				btnCard4.setBackground(Color.white);
			}
			
			
			if (hand1.size() > 4 && hand1.get(4) != null)
			{
				btnCard5.setText(hand1.get(4).getName());
				btnCard5.setToolTipText("Cost: " + (int)(hand1.get(4).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(4).getActiveDescription());
				btnCard5.setBackground(hand1.get(4).getColor());
			}
			else
			{
				btnCard5.setText("");
				btnCard5.setToolTipText("");
				btnCard5.setBackground(Color.white);
			}
			
			
			if (hand1.size() > 5 && hand1.get(5) != null)
			{
				btnCard6.setText(hand1.get(5).getName());
				btnCard6.setToolTipText("Cost: " + (int)(hand1.get(5).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(5).getActiveDescription());
				btnCard6.setBackground(hand1.get(5).getColor());
			}
			else
			{
				btnCard6.setText("");
				btnCard6.setToolTipText("");
				btnCard6.setBackground(Color.white);
			}
			
			
			if (hand1.size() > 6 && hand1.get(6) != null)
			{
				btnCard7.setText(hand1.get(6).getName());
				btnCard7.setToolTipText("Cost: " + (int)(hand1.get(6).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(6).getActiveDescription());
				btnCard7.setBackground(hand1.get(6).getColor());
			}
			else
			{
				btnCard7.setText("");
				btnCard7.setToolTipText("");
				btnCard7.setBackground(Color.white);
			}
			
			
			if (hand1.size() > 7 && hand1.get(7) != null)
			{
				btnCard8.setText(hand1.get(7).getName());
				btnCard8.setToolTipText("Cost: " + (int)(hand1.get(7).getCost() * g.getPlayerOne().getEgoCostRate()) +", " + hand1.get(7).getActiveDescription());
				btnCard8.setBackground(hand1.get(7).getColor());
				
			}
			else
			{
				btnCard8.setText("");
				btnCard8.setToolTipText("");
				btnCard8.setBackground(Color.white);
			}
			lblWhoseTurn.setText("Player One, it's your move.");
			
			if (g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.LOGIC) > 1)
			{
				btnLogicCharge.setForeground(Color.BLACK);
				btnLogicCharge.setText("Play a Logic Block");
				btnLogicCharge.setBackground(new Color(128,128,255));
				
			}
			else
			{
				btnLogicCharge.setForeground(Color.GRAY);
				btnLogicCharge.setText("Logic Charge: " + g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.LOGIC));
				btnLogicCharge.setBackground(new Color(224,224,255));
			}
			
			if (g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.ETHICS) > 1)
			{
				btnEthicsCharge.setForeground(Color.BLACK);
				btnEthicsCharge.setText("Play an Ethics Block");
				btnEthicsCharge.setBackground(new Color(255,255,128));
				
			}
			else
			{
				btnEthicsCharge.setForeground(Color.GRAY);
				btnEthicsCharge.setText("Ethics Charge: " + g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.ETHICS));
				btnEthicsCharge.setBackground(new Color(255,255,224));
			}
			
			if (g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.PASSION) > 1)
			{
				btnPassionCharge.setForeground(Color.BLACK);
				btnPassionCharge.setText("Play a Passion Block");
				btnPassionCharge.setBackground(new Color(255,128,128));
				
			}
			else
			{
				btnPassionCharge.setForeground(Color.GRAY);
				btnPassionCharge.setText("Passion Charge: " + g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.PASSION));
				btnPassionCharge.setBackground(new Color(255,224,224));
			}
			
			if (g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.DECEPTION) > 1)
			{
				btnDeceptionCharge.setForeground(Color.BLACK);
				btnDeceptionCharge.setText("Play a Deception Block");
				btnDeceptionCharge.setBackground(new Color(128,128,128));
				
			}
			else
			{
				btnDeceptionCharge.setForeground(Color.GRAY);
				btnDeceptionCharge.setText("Deception Charge: " + g.getPlayerOne().getCharges().getCharge(ChargeWheel.chargeType.DECEPTION));
				btnDeceptionCharge.setBackground(new Color(224,224,224));
			}
		}
		else
		{
			ArrayList<Card> hand2 = g.getPlayerTwo().getHand();
			
			if (hand2.size() > 0 && hand2.get(0) != null)
			{
				btnCard1.setText(hand2.get(0).getName());
				btnCard1.setToolTipText("Cost: " + (int)(hand2.get(0).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(0).getActiveDescription());
				btnCard1.setBackground(hand2.get(0).getColor());
			}
			else
			{
				btnCard1.setText("");
				btnCard1.setToolTipText("");
				btnCard1.setBackground(Color.white);
			}
			
			
			if (hand2.size() > 1 && hand2.get(1) != null)
			{
				btnCard2.setText(hand2.get(1).getName());
				btnCard2.setToolTipText("Cost: " + (int)(hand2.get(1).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(1).getActiveDescription());
				btnCard2.setBackground(hand2.get(1).getColor());
			}
			else
			{
				btnCard2.setText("");
				btnCard2.setToolTipText("");
				btnCard2.setBackground(Color.white);
			}
			
			
			if (hand2.size() > 2 && hand2.get(2) != null)
			{
				btnCard3.setText(hand2.get(2).getName());
				btnCard3.setToolTipText("Cost: " + (int)(hand2.get(2).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(2).getActiveDescription());
				btnCard3.setBackground(hand2.get(2).getColor());
			}
			else
			{
				btnCard3.setText("");
				btnCard3.setToolTipText("");
				btnCard3.setBackground(Color.white);
			}
			
			
			if (hand2.size() > 3 && hand2.get(3) != null)
			{
				btnCard4.setText(hand2.get(3).getName());
				btnCard4.setToolTipText("Cost: " + (int)(hand2.get(3).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(3).getActiveDescription());
				btnCard4.setBackground(hand2.get(3).getColor());
			}
			else
			{
				btnCard4.setText("");
				btnCard4.setToolTipText("");
				btnCard4.setBackground(Color.white);
			}
			
			
			if (hand2.size() > 4 && hand2.get(4) != null)
			{
				btnCard5.setText(hand2.get(4).getName());
				btnCard5.setToolTipText("Cost: " + (int)(hand2.get(4).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(4).getActiveDescription());
				btnCard5.setBackground(hand2.get(4).getColor());
			}
			else
			{
				btnCard5.setText("");
				btnCard5.setToolTipText("");
				btnCard5.setBackground(Color.white);
			}
			
			
			if (hand2.size() > 5 && hand2.get(5) != null)
			{
				btnCard6.setText(hand2.get(5).getName());
				btnCard6.setToolTipText("Cost: " + (int)(hand2.get(5).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(5).getActiveDescription());
				btnCard6.setBackground(hand2.get(5).getColor());
			}
			else
			{
				btnCard6.setText("");
				btnCard6.setToolTipText("");
				btnCard6.setBackground(Color.white);
			}
			
			
			if (hand2.size() > 6 && hand2.get(6) != null)
			{
				btnCard7.setText(hand2.get(6).getName());
				btnCard7.setToolTipText("Cost: " + (int)(hand2.get(6).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(6).getActiveDescription());
				btnCard7.setBackground(hand2.get(6).getColor());
			}
			else
			{
				btnCard7.setText("");
				btnCard7.setToolTipText("");
				btnCard7.setBackground(Color.white);
			}
			
			
			if (hand2.size() > 7 && hand2.get(7) != null)
			{
				btnCard8.setText(hand2.get(7).getName());
				btnCard8.setToolTipText("Cost: " + (int)(hand2.get(7).getCost() * g.getPlayerTwo().getEgoCostRate()) +", " + hand2.get(7).getActiveDescription());
				btnCard8.setBackground(hand2.get(7).getColor());
				
			}
			else
			{
				btnCard8.setText("");
				btnCard8.setToolTipText("");
				btnCard8.setBackground(Color.white);
			}
			lblWhoseTurn.setText("Player Two, it's your move.");
			
			if (g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.LOGIC) > 1)
			{
				btnLogicCharge.setForeground(Color.BLACK);
				btnLogicCharge.setText("Play a Logic Block");
				btnLogicCharge.setBackground(new Color(128,128,255));
				
			}
			else
			{
				btnLogicCharge.setForeground(Color.GRAY);
				btnLogicCharge.setText("Logic Charge: " + g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.LOGIC));
				btnLogicCharge.setBackground(new Color(224,224,255));
			}
			
			if (g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.ETHICS) > 1)
			{
				btnEthicsCharge.setForeground(Color.BLACK);
				btnEthicsCharge.setText("Play an Ethics Block");
				btnEthicsCharge.setBackground(new Color(255,255,128));
				
			}
			else
			{
				btnEthicsCharge.setForeground(Color.GRAY);
				btnEthicsCharge.setText("Ethics Charge: " + g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.ETHICS));
				btnEthicsCharge.setBackground(new Color(255,255,224));
			}
			
			if (g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.PASSION) > 1)
			{
				btnPassionCharge.setForeground(Color.BLACK);
				btnPassionCharge.setText("Play a Passion Block");
				btnPassionCharge.setBackground(new Color(255,128,128));
				
			}
			else
			{
				btnPassionCharge.setForeground(Color.GRAY);
				btnPassionCharge.setText("Passion Charge: " + g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.PASSION));
				btnPassionCharge.setBackground(new Color(255,224,224));
			}
			
			if (g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.DECEPTION) > 1)
			{
				btnDeceptionCharge.setForeground(Color.BLACK);
				btnDeceptionCharge.setText("Play a Deception Block");
				btnDeceptionCharge.setBackground(new Color(128,128,128));
				
			}
			else
			{
				btnDeceptionCharge.setForeground(Color.GRAY);
				btnDeceptionCharge.setText("Deception Charge: " + g.getPlayerTwo().getCharges().getCharge(ChargeWheel.chargeType.DECEPTION));
				btnDeceptionCharge.setBackground(new Color(224,224,224));
			}
		}
		
		lblEffect1.setText("Pick Something to Play!");
		
							
	}
	public void blackButtons()
	{
		btnCard1.setBackground(Color.BLACK);
		btnCard2.setBackground(Color.BLACK);
		btnCard3.setBackground(Color.BLACK);
		btnCard4.setBackground(Color.BLACK);
		btnCard5.setBackground(Color.BLACK);
		btnCard6.setBackground(Color.BLACK);
		btnCard7.setBackground(Color.BLACK);
		btnCard8.setBackground(Color.BLACK);
		
		btnCard1.setForeground(Color.BLACK);
		btnCard2.setForeground(Color.BLACK);
		btnCard3.setForeground(Color.BLACK);
		btnCard4.setForeground(Color.BLACK);
		btnCard5.setForeground(Color.BLACK);
		btnCard6.setForeground(Color.BLACK);
		btnCard7.setForeground(Color.BLACK);
		btnCard8.setForeground(Color.BLACK);
		
		btnLogicCharge.setBackground(Color.BLACK);
		btnEthicsCharge.setBackground(Color.BLACK);
		btnPassionCharge.setBackground(Color.BLACK);
		btnDeceptionCharge.setBackground(Color.BLACK);
		
		btnLogicCharge.setForeground(Color.BLACK);
		btnEthicsCharge.setForeground(Color.BLACK);
		btnPassionCharge.setForeground(Color.BLACK);
		btnDeceptionCharge.setForeground(Color.BLACK);
		
	}
}
